<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2016/4/23
 * Time: 21:56
 */

$url ="http://121.14.38.35/index.php";
function concat(array $param)
{
    ksort($param);
    $first = '';
    foreach ($param as $key => $val) {
        if(is_array($val)) {
            $first .= concat($val);
            continue;
        }

        if(!empty($val)) {
            $first .= $val;
        }
    }
    return $first;
}
function post_curl($url,$post_data){
    $ch = curl_init ();
    // print_r($ch);
    curl_setopt ( $ch, CURLOPT_URL, $url );
    curl_setopt ( $ch, CURLOPT_POST, 1 );
    curl_setopt ( $ch, CURLOPT_HEADER, 0 );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data );
    $return = curl_exec ( $ch );
    curl_close ( $ch );
    return $return;
}



$param = array();
//$param['apiCode'] = "_help_002";
$param['sid'] = "1";
$sign = concat($param)."32a0357b12de425b9b957b25f66cf002";
$param['token'] = md5($sign);
echo json_encode($param);
die;

$post_data['json'] = json_encode($param);
$res = post_curl($url,$post_data);
print_r(json_decode($res,true));
